#include <iostream>
#include <string>
#include <unistd.h>
#include "TcpServe.hpp"
#include "ServeCal.hpp"
void Userage(const std::string &manual)
{
  std::cout << "\nUserage " << manual << " port\n"
            << std::endl;
}

int main(int argc, char *argv[])
{
  if (argc != 2)
  {
    Userage(argv[0]);
    exit(0);
  }
  uint16_t port = std::stoi(argv[1]);
  ServeCal cal;
  Tcp *tcpserve = new Tcp(port, std::bind(&ServeCal::Calculator, &cal, std::placeholders::_1));
  tcpserve->Init();
  daemon(0,0);
  tcpserve->Start();
  return 0;
}